<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragments :: head(~{::title})">
    <title>物流管理系统</title>
</head>

<body class="layui-layout-body">

<div class="layui-layout layui-layout-admin">
    <!--头部导航栏-->
    <div th:replace="fragments :: topMenu"></div>

    <!--侧边导航栏-->
    <div th:if="${session.user.role==1}">
        <div th:replace="fragments :: sideMenu(5)"></div>
    </div>
    <div th:if="${session.user.role==0}">
        <div  th:replace="fragments :: sideMenuAdmin(5)"></div>
    </div>

    <!--中间内容-->
    <div class="layui-body">
        <div class="layui-tab" lay-filter="demo" lay-allowClose="true">
            <!--tab页主体内容区域-->
            <div class="layui-tab-content">
                <div>
                    <h2 class="ui dividing header">我寄出的</h2>
                    <table class="ui teal table">
                        <thead>
                        <tr>
                            <th>订单编号</th>
                            <th>收件人</th>
                            <th>订单重量(kg)</th>
                            <th>快递种类</th>
                            <th>订单时间</th>
                            <th>订单状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="post : ${postList}">
                            <td><a th:text="${post.num}" th:href="@{/toPostDetail/{id}(id=${post.id})}">2021050417405212</a></td>
                            <td th:text="${post.consignee}">Approved</td>
                            <td th:text="${post.weight}">12</td>
                            <td th:text="${post.category.cname}">普通快递</td>
                            <td th:text="${#dates.format(post.updateTime,'yyyy-MM-dd')}">2021-05-04 17:41</td>
                            <td th:if="${post.status==0}" style="color: red">未寄出</td>
                            <td th:if="${post.status==1}">已寄出</td>
                            <td th:if="${post.status==2}">已揽件</td>
                            <td th:if="${post.status==3}">已签收</td>
                            <td th:if="${post.status==0}">
                                <a th:href="@{/toUpdatePost/{id}(id=${post.id})}">
                                    <button class="ui teal button">修改</button>
                                </a>
                                <a class="delete" th:href="@{/deletePost/{id}(id=${post.id})}">
                                    <button class="ui red button">删除</button>
                                </a>
                            </td>
                            <td th:unless="${post.status==0}">
                                <button class="ui disabled button">快递已寄出,不能再进行操作</button>
                            </td>
                        </tr>
                        </tbody>
                        <tfoot>
                        <tr>
                            <th colspan="7">
                                <div class="ui mini pagination menu">
                                    <div class="item"><a
                                            th:href="@{/toUserSend(pageNum=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1)}">上一页</a>
                                    </div>
                                    <div class="item"><a
                                            th:href="@{/toUserSend(pageNum=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages})}">下一页</a>
                                    </div>
                                </div>
                            </th>
                        </tr>
                        </tfoot>
                    </table>
                    <div class="ui segment m-inline-block">
                        <p>当前第<span th:text="${pageInfo.pageNum}">1</span>页，总<span
                                th:text="${pageInfo.pages}">20</span>页，共<span
                                th:text="${pageInfo.total}">321</span>条记录</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--底部-->
    <div th:replace="fragments :: footer"></div>
</div>
</body>

<!--导入的script-->
<th:block th:replace="fragments :: script">
</th:block>

<script type="text/javascript">
    $(document).ready(function () {
        $(".delete").click(function () {
            if (confirm("确定删除吗")) {
                return true;
            }
            return false;
        });
    });
</script>

</html>